<template>
    <div>
        <!-- 三级联动组件(已经是全局组件) -->
        <TypeNav />
        <ListContainer />
        <Recommend />
        <Rank />
        <Like />
        <Floor v-for="floor in floorList" :key="floor.id" :list="floor" />
        <Brand />
    </div>
</template>

<script>
// 引入其余的组件
import ListContainer from "@/pages/Home/ListContainer/index";
import Recommend from "@/pages/Home/Recommend";
import Rank from "@/pages/Home/Rank/index";
import Like from "@/pages/Home/Like/index";
import Floor from "@/pages/Home/Floor";
import Brand from "@/pages/Home/Brand";

import { mapState, mapGetters } from "vuex";
export default {
    name: "Home",
    components: {
        ListContainer,
        Recommend,
        Rank,
        Like,
        Floor,
        Brand,
    },
    mounted() {
        // 获取三级联动信息
        this.$store.dispatch("getFloorList");

        // 下面获取用户信息同意使用路由守卫进行
        // 挂载完成,获取用户信息
        // this.$store.dispatch("getUserInfo");
    },
    computed: {
        ...mapState({
            floorList: (state) => state.home.floorList,
        }),
    },
};
</script>

<style>
</style>